<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::middleware([])->group(function () {
    Route::post('/user/sms', ['App\Http\Controllers\UserController', 'sendSms']);
    Route::post('/user/login', ['App\Http\Controllers\UserController', 'login']);
    Route::post('/user/wechat', ['App\Http\Controllers\UserController', 'wechat']);
    Route::get('/user/getJSSDK', ['App\Http\Controllers\UserController', 'getJSSDK']);
    Route::get('/user/wxsnsapi', ['App\Http\Controllers\UserController', 'wxsnsapi']);
    Route::get('/user/wxsnsapiok', ['App\Http\Controllers\UserController', 'wxsnsapiok']);
    Route::get('/user/getWxLoginToken', ['App\Http\Controllers\UserController', 'getWxLoginToken']);
    Route::post('/user/wxRegister', ['App\Http\Controllers\UserController', 'wxRegister']);
    Route::get('/user/wxLogin', ['App\Http\Controllers\UserController', 'wxLogin']);
    Route::post('/user/wechat/register', ['App\Http\Controllers\UserController', 'wxLoginRegister']);
    Route::post('/user/wechat/login', ['App\Http\Controllers\UserController', 'login']);
    Route::post('/file/upload', ['App\Http\Controllers\UserController', 'upload']);
    Route::any('/user/task/callback', ['App\Http\Controllers\TaskController', 'callback']);
    Route::get('/notice/list', ['App\Http\Controllers\NoticeController', 'list']);
});

Route::middleware(['auth:sanctum'])->group(function () {
    Route::get('/user', ['App\Http\Controllers\UserController', 'index']);
    Route::get('/coin/list', ['App\Http\Controllers\CoinController', 'list']);
    Route::get('/coin/info', ['App\Http\Controllers\CoinController', 'info']);
    Route::get('/coin/clue/list', ['App\Http\Controllers\CoinController', 'clueList']);
    Route::get('/coin/user/top', ['App\Http\Controllers\CoinController', 'userTop']);
    Route::get('/coin/getCoinInfo', ['App\Http\Controllers\CoinController', 'getCoinInfo']);
    Route::get('/coin/getVideo', ['App\Http\Controllers\CoinController', 'getCoinVideo']);
    Route::get('/sign/config', ['App\Http\Controllers\SignController', 'config']);
    Route::get('/user/sign/info', ['App\Http\Controllers\SignController', 'userSignInfo']);
    Route::post('/user/sign', ['App\Http\Controllers\SignController', 'userSign']);
    Route::get('/user/share/config', ['App\Http\Controllers\UserController', 'getShareConfig']);
    Route::get('/user/share/list', ['App\Http\Controllers\UserController', 'getShareList']);
    Route::get('/user/coin/list', ['App\Http\Controllers\UserController', 'coinList']);
    Route::post('/user/coin/save', ['App\Http\Controllers\UserController', 'coinSave']);
    Route::post('/user/coin/pay', ['App\Http\Controllers\UserController', 'coinPay']);
    Route::post('/user/coin/gold/save', ['App\Http\Controllers\UserController', 'goldCoinSave']);
    Route::post('/user/coin/clue/save', ['App\Http\Controllers\UserController', 'coinClueSave']);
    Route::post('/contact/save', ['App\Http\Controllers\ContactController', 'save']);
    Route::post('/lottery/go', ['App\Http\Controllers\LotteryController', 'golottery']);
    Route::get('/lottery/get', ['App\Http\Controllers\LotteryController', 'get']);
    Route::get('/user/code', ['App\Http\Controllers\UserController', 'code']);
    Route::get('/user/wechat/qrcode', ['App\Http\Controllers\UserController', 'getMiniProgramQrcode']);
    Route::post('/user/code/save', ['App\Http\Controllers\UserController', 'codeSave']);
    Route::post('/user/save/nickname', ['App\Http\Controllers\UserController', 'saveNickname']);
    Route::post('/user/save/avatar', ['App\Http\Controllers\UserController', 'saveAvatar']);
    Route::get('/task/list', ['App\Http\Controllers\TaskController', 'list']);
    Route::post('/user/task/save', ['App\Http\Controllers\TaskController', 'save']);
});
